<%@page import="java.net.URLDecoder"%>
<%@page import="java.net.URLEncoder"%>
<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script language="JavaScript">
	function trim(stringToTrim) {
		return stringToTrim.replace(/^\s+|\s+$/g,"");
	}
	function ltrim(stringToTrim) {
		return stringToTrim.replace(/^\s+/,"");
	}
	function rtrim(stringToTrim) {
		return stringToTrim.replace(/\s+$/,"");
	}
				function Validate()
				  {
					 /*var image =document.getElementById("image").value;
					 if(image!=''){
						  var checkimg = image.toLowerCase();
						  if (!checkimg.match(/(\.jpg|\.png|\.JPG|\.PNG|\.jpeg|\.JPEG)$/)){
							  alert("Please enter  Image  File Extensions .jpg,.png,.jpeg");
							  document.getElementById("image").focus();
							  return false;
						    }
						 }
					 return true;*/
					 
					 var file=document.getElementById("txtfile").value;
					 var title=document.getElementById("txttitle").value;
					 var desc=document.getElementById("txtdesc").value;
					 if(trim(title)==""){
						 alert("Please enter title");
						 document.getElementById("txttitle").focus();
						 return false;
					 }
					 return true;
				 }	
				
</script>
</head>
<body>
<c:if test="${fn:length(CourseList)>0}">
<c:forEach var="x" begin="0" end="${fn:length(CourseList)-1}" step="1" varStatus ="status">
<form name="frm" method="post" action="update_course.html?course_id=${CourseList[x].COURSE_ID}" onsubmit="return Validate();">
<table cellpadding="0" cellspacing="0" width="730" align="center" border="0"​ class="newsTitle">
	<tr><td colspan="2" height="10"> </td></tr>	
	<tr align="center"><td colspan="2" height="30" style="font-size:14px;"><u>កែប្រែវគ្គសិក្សា</u></td></tr>
	<tr><td colspan="2" height="10"> </td></tr>
	
	<tr>
		<td height="30" width="30%" align="right">* ចំណងជើង :&nbsp;</td>	
		<td align="left"><input type="text" id="txttitle" name="txttitle" value="${CourseList[x].COURSE_NAME}" maxlength="250" style="width: 580px;" class="box"/></td>
	</tr>
	<tr><td colspan="2" height="10"> </td></tr>
	<tr>
		<td align="right"> បរិយាយ :&nbsp;</td>	
		<td align="left"><textarea name="txtdesc" id="txtdesc" rows="10" style="font-family: verdana, sans-serif;font-size:11px;width: 580px;"><c:out value="${CourseList[x].COURSE_DESC}"></c:out></textarea></td>
	</tr>
	<tr><td colspan="2" height="3"> </td></tr>
	<tr>
		<td align="right"> សេចក្តីណែនាំ :&nbsp;</td>	
		<td align="left"><textarea name="txtinstruction" id="txtinstruction" rows="10" style="font-family: verdana, sans-serif;font-size:11px;width: 580px;"><c:out value="${CourseList[x].INSTRUCTION_DESC}"></c:out></textarea></td>
	</tr>
	<tr><td colspan="2" height="10"> </td></tr>
	<tr>
		<td align="right">* ប្រភេទឯកសារ :&nbsp;</td>	
		<td align="left">
			<select name="txtcat" id="txtcat" style=" height: 25px; ">
				<c:forEach var="y" begin="0" end="${fn:length(categories)-1 }" step="1" varStatus="status">
					<c:choose>
						<c:when test="${CourseList[x].CATEGORY_ID==categories[y].CATEGORY_ID}">
							<option value="${categories[y].CATEGORY_ID}" selected="selected"><c:out value="${categories[y].CATEGORY_NAME}"></c:out></option>
						</c:when>
						<c:otherwise>
							<option value="${categories[y].CATEGORY_ID}"><c:out value="${categories[y].CATEGORY_NAME}"></c:out></option>
						</c:otherwise>
					</c:choose>
				</c:forEach>		
			</select>
		</td>
	</tr>
	<tr><td colspan="2" height="10"> </td></tr>
	<tr>
		<td height="30" width="30%" align="right"> ពាក្យគន្លឹះ :&nbsp;</td>	
		<td align="left"><input type="text" id="txtkeywords" value="${keywords}" name="txtkeywords" maxlength="250" style="width: 580px;" class="box"/></td>
	</tr>
	<tr><td colspan="2" height="10"> </td></tr>
	<tr>
		<td height="5"></td>
		<td height="5" align="left" style="font-size: 10px;">* តំរូវអោយបញ្ចូល</td>
	</tr>
	<tr><td colspan="2" height="10"> </td></tr>
	<tr>
		<td colspan="2" align="center" height="30"><input type="submit" class="input_button" value="រក្សាទុក">&nbsp;&nbsp;<input type="button" class="input_button" onclick='window.location="course_list.html"' value="ចាកចេញ"></td>
	</tr>
	<tr><td colspan="2" height="25">&nbsp;</td></tr>
</table>
</form>
</c:forEach>
</c:if>
</body>
</html>